<!-- 市场结算交易订单 -->
<template>
    <div>
        <el-breadcrumb separator="/" class="bread-title">
            <el-breadcrumb-item :to="{ path: '/marketSettlement' }">市场结算</el-breadcrumb-item>
            <el-breadcrumb-item :to="{ path: '/marketSettlementDetail',query:{standardId:reportMonthId,month:ruleForm.month}}">市场结算详情</el-breadcrumb-item>
            <el-breadcrumb-item>交易订单</el-breadcrumb-item>
        </el-breadcrumb>

        <el-form :inline="true" :model="ruleForm" class="demo-form-inline">
            <el-form-item label="客户姓名：">
                <el-input placeholder="请输入客户姓名" v-model.trim="ruleForm.customerName" maxlength="20" size="small"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="success"  @click="searchList" id="monitorEnter" size="small">查询</el-button>
            </el-form-item>
        </el-form>

        <el-table :data="tableData" border style="width: 100%">
            <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
            <el-table-column label="客户姓名" prop="customerName" align="center"></el-table-column>
            <el-table-column label="房号信息" prop="houseInfo" align="center"></el-table-column>
            <el-table-column label="营收业绩（元）"  prop="marketTotalAmount"  :formatter="initCash" align="center"></el-table-column>
            <el-table-column label="营收结算计提节点"  prop="revenueNodeName" align="center">
                <template slot-scope="scope">
                    <span>{{scope.row.revenueNodeName?scope.row.revenueNodeName:'———'}}</span>
                </template>
            </el-table-column>
            <el-table-column label="计提比例%"  prop="revenueCalProportion" align="center">
                <template slot-scope="scope">
                    <span>{{scope.row.revenueCalProportion?scope.row.revenueCalProportion:'———'}}</span>
                </template>
            </el-table-column>
            <el-table-column label="营收结算（元）"  :formatter="initCash"  prop="revenueAmount" align="center"></el-table-column>
            <el-table-column label="房屋总价" :formatter="initCash" prop="houseDealAmount" align="center"></el-table-column>
            <el-table-column label="成交结算计提节点"  prop="dealNodeName" align="center">
                <template slot-scope="scope">
                    <span>{{scope.row.dealNodeName?scope.row.dealNodeName:'———'}}</span>
                </template>
            </el-table-column>
            <el-table-column label="成交结算（元）" :formatter="initCash" prop="dealSettlementAmount" align="center"></el-table-column>
            <el-table-column label="营收业绩（元）" :formatter="initCash" prop="marketTotalAmount" align="center"></el-table-column>
            <el-table-column label="市场结算计提节点" prop="marketCalNodeName" align="center"></el-table-column>
            <el-table-column label="计提比例%"  prop="marketCalProportion" align="center"></el-table-column>
            <el-table-column label="市场结算" prop="marketCalAmount" :formatter="initCash" align="center"></el-table-column>
        </el-table>

        <div class="pagebar">
          <el-pagination
            background
            layout="total, sizes, prev, pager, next"
            :current-page.sync="ruleForm.pageNum"
            :page-sizes="[10, 20, 30, 40]"
            :page-size="ruleForm.pageSize"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :total="totalSize">
          </el-pagination>
        </div>

    </div>
</template>
<script>
    import api from '@/api/apiPath'
    export default {
        data () {
            return {
                ruleForm:{
                    customerName:undefined,
                    month:undefined,
                    devId:undefined,
                    pageNum: 0,
                    pageSize: 10,
                },
                levellist:[],
                devlist:[],
                totalSize:0,
                tableData:[],
                reportMonthId:undefined,//面包屑跳转传参
            }
        },
        methods:{
            initCash(row, column, cellValue, index){
                if(!cellValue && typeof cellValue!="undefined" && cellValue!=0){
                     return '———'
                }
                if (cellValue < 0) {
                    return cellValue
                }
                if(cellValue !== 0 && cellValue >0){
                    return cellValue.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");
                }
                if(cellValue == 0){
                    return "0.00"
                }
            },
            getlist(){
                this.axios.post(api.TRADEORDERLIST,this.ruleForm).then((res) => {
                    if (res.data.code == 200) {
                        this.tableData = res.data.data.data;
                        this.totalSize = res.data.data.total;
                    }
                })
            },
            handleCurrentChange(){
                this.getlist()
            },
            handleSizeChange(val){
                this.ruleForm.pageSize = val
                this.getlist();
            },
            searchList(){
                this.ruleForm.pageNum = 1
                this.getlist()
            }
        },
        created(){
            this.ruleForm.month = this.$route.query.month
            this.ruleForm.devId = this.$route.query.devId
            this.reportMonthId = this.$route.query.reportMonthId
            this.getlist()
        }
    }
</script>


<style lang="stylus" scoped>
</style>